﻿using Blog.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Blog.Controllers
{
    public class RegsController : Controller
    {
        // GET: Regs
        UserEntities db = new UserEntities();

        public ActionResult Index()
        {
            using (UserEntities db = new UserEntities())
            {
                var user = db.Sing.ToList();
                return View(user);
            }

        }
        [HttpPost]

        public ActionResult add(Reg r)
        {
            Reg rr = new Reg()
            {
                UserName = r.UserName,
                Name = r.Name,
                Passwoed = r.Passwoed,
                Email = "0",
                self_introduction = "0",
                Miaoshu="0",
                Avatar="0"
            };
            db.Reg.Add(rr);
            db.SaveChanges();
            return Content("<script>alert('注册成功');location='EDG/index'</script>");
            

    }

}
}